﻿<Page
    x:Class="TelemetryMobileService.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:TelemetryMobileService"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="0,18,0,18">
            <TextBlock Text="Sensor Mobile Service" Style="{StaticResource TitleTextBlockStyle}" Margin="18,0"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="18,0,18,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="2*" />
                <ColumnDefinition Width="2*" />
                <ColumnDefinition Width="2*" />
            </Grid.ColumnDefinitions>
            <Grid Grid.Row="4" Grid.ColumnSpan="3">
                <Grid.RowDefinitions>
                    <RowDefinition Height="60"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <!--ColumnDefinition Width="60"/ -->
                    <ColumnDefinition Width="50"/>
                    <ColumnDefinition Width="125"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0"  x:Name="IdTextblockH" Text="Id" VerticalAlignment="Center"  />

                <TextBlock Grid.Column="1"  x:Name="SensorTextblockH" Text="Sensor" VerticalAlignment="Center"  />
                <TextBlock Grid.Column="2" x:Name="ValueTextBlockH" Text="Value" VerticalAlignment="Center" TextAlignment="Center" Width="100" />
            </Grid>
            <TextBlock Grid.Row="0" Grid.ColumnSpan="3" Style="{StaticResource BodyTextBlockStyle}" Text="Enter a sensor, its value and save." TextWrapping="Wrap"/>
            <TextBox Grid.Row="1" Grid.ColumnSpan="2" Grid.Column="0" Name="SensorInput" Text="" />
            <Button Grid.Row ="1" Grid.Column="2"  Name="ButtonSave" Click="ButtonSave_Click" IsEnabled="False"  HorizontalAlignment="Stretch" Margin="5, 0, 0, 0">Save</Button>
            <TextBlock Grid.Row="2" Grid.ColumnSpan="1" Style="{StaticResource BodyTextBlockStyle}" Text="Value: " TextWrapping="Wrap" VerticalAlignment="Center" TextAlignment="Right"/>
            <TextBox Grid.Row="2" Grid.Column="1" Name="ValueInput" Text="" Width="100" InputScope="Number" />
            <TextBlock x:Name="Hint" Grid.Row="2" Grid.Column="2" Style="{StaticResource BodyTextBlockStyle}" Text="Press here after refresh: " TextWrapping="Wrap" VerticalAlignment="Center" TextAlignment="Center" FontSize="14"/>
            <TextBlock Grid.Row="3" Grid.ColumnSpan="2" Style="{StaticResource BodyTextBlockStyle}" Text="Reload current data:" Margin="10,1" TextWrapping="Wrap" TextAlignment="Right"  VerticalAlignment="Center"/>
            <Button Grid.Row="3" Grid.Column="3" Name="ButtonRefresh" Click="ButtonRefresh_Click" HorizontalAlignment="Stretch" Margin="5, 0, 0, 0">Refresh</Button>
            <ListView  Grid.Row="5" Grid.ColumnSpan="3" Name="ListItems">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="50"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <!-- ColumnDefinition Width="60"/ -->
                                <ColumnDefinition Width="50"/>
                                <ColumnDefinition Width="125"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <!--CheckBox  Grid.Column="0" Name="CheckBoxComplete" IsChecked="{Binding Complete, Mode=TwoWay}" Checked="CheckBoxComplete_Checked" Content=""  Margin="10,1" VerticalAlignment="Center"/ -->
                            <TextBlock Grid.Column="0"  x:Name="IdTextblock" Text="{Binding Id}" VerticalAlignment="Center"  />
                            <TextBlock Grid.Column="1"  x:Name="SensorTextblock" Text="{Binding Sensor}" VerticalAlignment="Center"  />
                            <TextBlock Grid.Column="2" x:Name="ValueTextBlock" Text="{Binding Value}" VerticalAlignment="Center" TextAlignment="Right" Width="100" />
                        </Grid>
                        <!--<StackPanel Orientation="Horizontal">
                            <CheckBox Name="CheckBoxComplete" IsChecked="{Binding Complete, Mode=TwoWay}" Checked="CheckBoxComplete_Checked" Content="{Binding Sensor}" Margin="10,5" VerticalAlignment="Center"/>
                        </StackPanel>-->
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </Grid>
    </Grid>
</Page>
